import time

from selenium.webdriver.common.by import By
from Base import Base
class Page(Base):
    #定位器
    #登录的定位
    login_loc=(By.XPATH,'//a[@href="/home/login.html"]')
    def login(self):
        self.click(self.login_loc)
    #断言文本：会员登录
    dy1_loc=(By.CLASS_NAME,'reg-new')
    def dy1(self):
        return self.text(self.dy1_loc)
    #用户名的定位
    username_loc=(By.NAME,'username')
    def username(self):
        self.send_keys(self.username_loc,'13681034647')
    #密码的定位
    password_loc=(By.NAME,'password')
    def password(self):
        self.send_keys(self.password_loc,'111111')
    #登录按钮的定位
    loginbtn_loc=(By.CLASS_NAME,'finish-btn')
    def loginbtn(self):
        self.click(self.loginbtn_loc)
    #断言文本：欢迎回来，13681034647
    dy2_loc=(By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a')
    def dy2(self):
        return self.text(self.dy2_loc)
    #业务逻辑
    def luoji_A3mall(self):
        self.open_url('http://10.59.9.12:7001/')
        self.login()
        print(self.dy1())
        self.username()
        self.password()
        time.sleep(10)
        self.loginbtn()
        time.sleep(5)
        print(self.dy2())